package zy0153;

public class number extends Thread{
	private Num num;
	public number(Num num) {
		this.num=num;
	}
	@Override
	public void run() {
		while(true){
			synchronized(num.getLock()){
				if(num.getI()>num.getNum()){
					break;
				}else{
					if(num.getI()%3!=0&&num.getI()%5!=0){
						System.out.println(num.getI());
						num.getLock().notify();
						num.setI(num.getI()+1);
					}else{
						try {
							num.getLock().wait();
						} catch (InterruptedException e) {
							// TODO Auto-generated catch block
							e.printStackTrace();
						}
					}
				}
			}
		}
	}
}
